package com.qczl.pme.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.qczl.core.controller.BaseController;
import com.qczl.pme.entity.PMEVideo;
import com.qczl.pme.service.VideoCallBackService;

/**
 * sewise 回调
 * @author SongR
 *
 */
@Controller
@RequestMapping(value="/callback")
public class VideoCallBackController extends BaseController{
	
	Logger log = Logger.getLogger(this.getClass());
	
	@Autowired
	VideoCallBackService videocallbackservice;
	
	/**
	 * 驻村干部签到回调
	 * @param phone
	 * @param taskid
	 * @param download_url
	 * @param play_url
	 * @param duration
	 * @return
	 */
	@RequestMapping(value="/zhucun/v1")
	public void callbackZhucun(String taskid,String download_url,String play_url,Integer duration){
		PMEVideo video = new PMEVideo();
		try {
			video.setTaskId(taskid);
			video.setDownloadUrl(download_url);
			video.setDuration(new Long(duration));
			video.setPlayUrl(play_url);
			videocallbackservice.callbackZhucun(video);
		} catch (Exception e) {
			log.error("sewise驻村干部签到回调接口异常！",e);
		}
	}
	
	/**
	 * 直播录制回调
	 * @作者:SongR
	 * @版本:v1
	 * @日期:2017年9月21日 下午2:04:56
	 */
	@RequestMapping(value="/live/v1")
	public void callbackLiveV1(String taskid,String download_url,String play_url,Integer duration){
		System.out.println(taskid);
		try {
			videocallbackservice.callBackLiveV1(taskid,download_url,play_url,duration);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 会议录制回调
	 * @作者:SongR
	 * @版本:v1
	 * @日期:2017年9月25日 下午5:13:25
	 */
	@RequestMapping(value="/metting/v1")
	public void callbackMettingV1(String taskid,String download_url,String play_url,Integer duration){
		System.out.println(taskid);
		try {
			videocallbackservice.callBackMettingV1(taskid,download_url,play_url,duration);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
